<?php

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use \dmstr\bootstrap\Tabs;
use yii\helpers\StringHelper;

/**
* @var yii\web\View $this
* @var yiike\company\model\TtycMaker $model
* @var yii\widgets\ActiveForm $form
*/

?>

<div class="ttyc-maker-form">

    <?php $form = ActiveForm::begin([
    'id' => 'TtycMaker',
    'layout' => 'horizontal',
    'enableClientValidation' => true,
    'errorSummaryCssClass' => 'error-summary alert alert-danger',
    'fieldConfig' => [
             'template' => "{label}\n{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}",
             'horizontalCssClasses' => [
                 'label' => 'col-sm-2',
                 #'offset' => 'col-sm-offset-4',
                 'wrapper' => 'col-sm-8',
                 'error' => '',
                 'hint' => '',
             ],
         ],
    ]
    );
    ?>

    <div class="">
        <?php $this->beginBlock('main'); ?>

        <p>

<!-- attribute status -->
			<?= $form->field($model, 'status')->dropdownList([
                1 => '启用',
                2 => '关闭'
            ],
                ['prompt'=>'选择']
            );?>

<!-- attribute name -->
			<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

<!-- attribute idcard -->
			<?= $form->field($model, 'idcard')->textInput(['maxlength' => true]) ?>

<!-- attribute bank_account -->
			<?= $form->field($model, 'bank_account')->textInput(['maxlength' => true]) ?>

<!-- attribute tel -->
			<?= $form->field($model, 'tel')->textInput(['maxlength' => true]) ?>
<!-- attribute bank -->
			<?= $form->field($model, 'bank')->textInput(['maxlength' => true]) ?>

<!-- attribute payee -->
			<?= $form->field($model, 'payee')->textInput(['maxlength' => true]) ?>


            <?=
            $form->field($model, '地区')->widget(\chenkby\region\Region::className(),[
                'model'=>$model,
                'url'=> \yii\helpers\Url::toRoute(['get-region']),
                'province'=>[
                    'attribute'=>'province',
                    'items'=> \common\models\Region::getRegion(),
                    'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择省份']
                ],
                'city'=>[
                    'attribute'=>'city',
                    'items'=>\common\models\Region::getRegion($model['province']),
                    'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择城市']
                ],
                'district'=>[
                    'attribute'=>'district',
                    'items'=>\common\models\Region::getRegion($model['city']),
                    'options'=>['class'=>'form-control form-control-inline','prompt'=>'选择县/区']
                ]
            ]);
            ?>
            <!-- attribute address -->
            <?= $form->field($model, 'address')->textInput(['maxlength' => true])->label('详细地址') ?>
        </p>
        <?php $this->endBlock(); ?>
        
        <?=
    Tabs::widget(
                 [
                    'encodeLabels' => false,
                    'items' => [ 
                        [
    'label'   => Yii::t('models', '商务专员'),
    'content' => $this->blocks['main'],
    'active'  => true,
],
                    ]
                 ]
    );
    ?>
        <hr/>

        <?php echo $form->errorSummary($model); ?>

        <?= Html::submitButton(
        '<span class="glyphicon glyphicon-check"></span> ' .
        ($model->isNewRecord ? '添加' : '保存'),
        [
        'id' => 'save-' . $model->formName(),
        'class' => 'btn btn-success'
        ]
        );
        ?>

        <?php ActiveForm::end(); ?>

    </div>

</div>

